/**
 *
 * jcrt and its source-code is licensed under the LGPL.
 * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
 * When copying, adapting, or redistributing this document in keeping with the guidelines above,
 * you are required to provide proper attribution to obinary.
 * If you reproduce or distribute the document without making any substantive modifications to its content,
 * please use the following attribution line:
 *
 * Copyright 2007 Atjava.com Ltd. (http://www.atjava.com) All rights reserved.
 *
 */
package com.atjava.jcrt.core;

import java.util.Map;
import java.util.Properties;

import org.apache.commons.lang.StringUtils;


/**
 * @author biggie
 * @version $Revision: 1.3 $ $Date: 2008/08/07 00:52:23 $
 */
public final class SystemProperty {

	public static String SYSTEM_REALPATH = null;
	//public static String SYSTEM_REALPATH = "";//use in Test
	public static final String DEFAULT_JCRT_CFG="jcrt.cfg.xml";//default jcrt configure

    public static final String JCRT_CONFIG_FILE = "configFile"; 

    public static final String JCRT_REPOSITORY_HOME = "repositoryHome";

    public static final String JCRT_CONTEXT_FACTORY_CLASS = "contextFactoryClass";

    public static final String JCRT_PROVIDER_URL = "providerURL";
    
    public static final String JCRT_BIND_NAME = "bindName";

    public static final String JCRT_GENERATOR_INCREMENT = "increment";

    public static final String JCRT_GENERATOR_CURRENT_TIME_MILLIS = "currentTimeMillis";
    
    public static final String JCRT_NAMESPACE_PREFIX = "prefix";
    
    public static final String JCRT_NAMESPACE_URI = "uri";
    
    public static final String JCRT_CLASS_TYPE="classType";
    
    private static Properties properties = new Properties();

    /**
     * Utility class, don't instantiate.
     */
    private SystemProperty() {
        // unused
    }

    /**
     * @param name
     * @param value
     */
    public static void setProperty(String name, String value) {
        SystemProperty.properties.put(name, value);
    }

    /**
     * @param name
     */
    public static String getProperty(String name) {
        return (String) SystemProperty.properties.get(name);
    }

    /**
     * @param name
     * @param defaultValue
     */
    public static String getProperty(String name, String defaultValue) {
        String value = getProperty(name);
        if (StringUtils.isEmpty(value)) {
            return defaultValue;
        }
        return value;
    }

    /**
     * @deprecated use getProperties() instead
     */
    public static Map getPropertyList() {
        return SystemProperty.properties;
    }

    public static Properties getProperties() {
        return SystemProperty.properties;
    }
    
}
